package com.zr.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zr.model.Worker;
import com.zr.service.WorkerService;

public class UpdateWorkerController extends HttpServlet{
	WorkerService workerservice=new WorkerService();
	@Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	// TODO Auto-generated method stub
	doPost(req, resp);
}
        @Override
    	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    		// TODO Auto-generated method stub
        	resp.setCharacterEncoding("utf8");           
        	req.setCharacterEncoding("utf8");
        	int wid= Integer.parseInt(req.getParameter("wid"));
            String wname =req.getParameter("wname");
            int wage=Integer.parseInt(req.getParameter("wage"));
            String wsex =req.getParameter("wsex");
            String wphone =req.getParameter("wphone");
            String wadress =req.getParameter("wadress");
            int did=Integer.parseInt(req.getParameter("did"));
            String dname =req.getParameter("dname");
            int work_age=Integer.parseInt(req.getParameter("work_age"));
           PrintWriter pw= resp.getWriter();
           int result=workerservice.updateStudent(wid, wname, wage, wsex, wphone, wadress, did, dname, work_age);
           pw.write(String.valueOf(result));
        }
}
